package com.hsd.aop.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 动态代理类
 */
public class Businessman implements InvocationHandler {
    private Object target;

    public Businessman(Object target) {
        this.target = target;
    }

    public Businessman() {

    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("tip:我要打广告了！");
        Object invoke = method.invoke(target, args);//调用被代理类（target）实例的接口的实现方法
        return invoke;
    }
}
